Functions

The functions in gnuplot are the same as the corresponding functions in the Unix math library, except that all functions accept integer, real, and complex arguments, unless otherwise noted.

For those functions that accept or return angles that may be given in either degrees or radians (sin(x), cos(x), tan(x), asin(x), acos(x), atan(x), atan2(x) and arg(z)), the unit may be selected by set angles, which defaults to radians.

Math library functions
Function Arguments Returns
abs(x) any absolute value of x, | x|; same type
abs(x) complex length of x, $\sqrt{{{\mbox{real}(x)^{2} +
\mbox{imag}(x)^{2}}}}$
acos(x) any cos-1x (inverse cosine)
acosh(x) any cosh-1x (inverse hyperbolic cosine) in radians
arg(x) complex the phase of x
asin(x) any sin-1x (inverse sin)
asinh(x) any sinh-1x (inverse hyperbolic sin) in radians
atan(x) any tan-1x (inverse tangent)
atan2(y,x) int or real tan-1(y/x) (inverse tangent)
atanh(x) any tanh-1x (inverse hyperbolic tangent) in radians
besj0(x) int or real j0 Bessel function of x, in radians
besj1(x) int or real j1 Bessel function of x, in radians
besy0(x) int or real y0 Bessel function of x, in radians
besy1(x) int or real y1 Bessel function of x, in radians
ceil(x) any x⌉, smallest integer not less than x (real part)
cos(x) any cos x, cosine of x
cosh(x) any cosh x, hyperbolic cosine of x in radians
erf(x) any erf(real(x)), error function of real(x)
erfc(x) any erfc(real(x)), 1.0 - error function of real(x)
exp(x) any ex, exponential function of x
floor(x) any x⌋, largest integer not greater than x (real part)
gamma(x) any gamma(real(x)), gamma function of real(x)
ibeta(p,q,x) any ibeta(real(p, q, x)), ibeta function of real(p,q,x)
inverf(x) any inverse error function of real(x)
igamma(a,x) any igamma(real(a, x)), igamma function of real(a,x)
imag(x) complex imaginary part of x as a real number
invnorm(x) any inverse normal distribution function of real(x)
int(x) real integer part of x, truncated toward zero
lgamma(x) any lgamma(real(x)), lgamma function of real(x)
log(x) any logex, natural logarithm (base e) of x
log10(x) any log10x, logarithm (base 10) of x
norm(x) any normal distribution (Gaussian) function of real(x)
rand(x) any rand(real(x)), pseudo random number generator
real(x) any real part of x
sgn(x) any 1 if x > 0, -1 if x < 0, 0 if x = 0. imag(x) ignored
sin(x) any sin x, sine of x
sinh(x) any sinh x, hyperbolic sine x in radians
sqrt(x) any $\sqrt{{x}}$, square root of x
tan(x) any tan x, tangent of x
tanh(x) any tanh x, hyperbolic tangent of x in radians

A few additional functions are also available.

other gnuplot functions
Function Arguments Returns
column(x) int column x during datafile manipulation.
tm_hour(x) int the hour
tm_mday(x) int the day of the month
tm_min(x) int the minute
tm_mon(x) int the month
tm_sec(x) int the second
tm_wday(x) int the day of the week
tm_yday(x) int the day of the year
tm_year(x) int the year
valid(x) int test validity of column(x) during datafile manip.